import { BaseItem } from "../common/BaseItem";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { SkillInfo } from "../../model/SkillInfo";
import { IDragDrop } from "../../../../com/mui/manager/IDragDrop";
import { SkillItem } from "../skill/SkillItem";
import { ShortcutsItem } from "../shortcuts/ShortcutsItem";
import { DragManager } from "../../../../com/mui/manager/DragManager";
//class FightSkillItem
    
    export  class FightSkillItem extends BaseItem
    {
        constructor()
        {
            super();
            return;
        }

        public set isUseable(arg1: Boolean)
        {
            this._isUseable = arg1;
            if (arg1) 
            {
                if (_bitmap) 
                {
                    _bitmap.filters = [];
                }
            }
            else if (_bitmap) 
            {
                _bitmap.filters = [FilterConst.colorFilter];
            }
            return;
        }

        public get isUseable(): Boolean
        {
            return this._isUseable;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this._bgBitmap = new Object /* flash.display.Bitmap */();
            this._bgBitmap.x = -3;
            this._bgBitmap.y = -3;
            addChildAt(this._bgBitmap, 1);
            this._bgBitmap.bitmapData = GlobalClass.getBitmapData(ImagesConst.PackItemBg);
            return;
        }

        public set bgBitmap(arg1: Object /* flash.display.BitmapData */)
        {
            this._bgBitmap.bitmapData = arg1;
            return;
        }

        public /* override */ get dragSource(): Object
        {
            return this._dragSource;
        }

        public /* override */ set dragSource(arg1: Object)
        {
            var loc1=arg1 as SkillInfo;
            if (loc1) 
            {
                this.source = loc1.tSkill.skillIcon.toString() + ".jpg";
            }
            else 
            {
                this.source = null;
            }
            this._dragSource = arg1;
            return;
        }

        public /* override */ canDrop(arg1: IDragDrop, arg2: IDragDrop): Boolean
        {
            var loc1=arg1 as BaseItem;
            if (loc1) 
            {
                if (arg1 is SkillItem || arg1 is FightSkillItem || arg1 is ShortcutsItem) 
                {
                    return true;
                }
            }
            return false;
        }

        public /* override */ get toolTipData()
        {
            var loc1="";
            if (this.dragSource) 
            {
                return (this.dragSource as SkillInfo).getShortToolTips();
            }
            return null;
        }

        protected /* override */ onMouseDown(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this.isDragAble) 
            {
                DragManager.instance.startDragItem(this);
            }
            return;
        }

        public destroy(): void
        {
            this.dragSource = null;
            this.itemData = null;
            return;
        }

        /* internal */ /* var */_dragSource: Object;

        /* internal */ /* var */_bgBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_isUseable: Boolean=true;
    }
